/*
 * @(#)BannerDAOImpl.java $version 2012-8-13
 * 
 * Copyright 2012 NADOSTAR Gruop. All rights Reserved.
 * NADOSTAR PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nadostar.iims.service.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.nadostar.extensions.SimpleSqlMapDaoSupport;
import com.nadostar.extensions.util.DataMap;
import com.nadostar.iims.service.dao.BannerDAO;

/**
 * The Class BannerDAOImpl.
 * 
 * @author Lixing
 *
 */
@Repository("BannerDAO")
public class BannerDAOImpl extends SimpleSqlMapDaoSupport implements BannerDAO {
	private static final String PREFIX = "com.nadostar.iims.service.banner.";
	
	@SuppressWarnings("unchecked")
	public List<DataMap> selectBannerList(int bnnrThmSeq, String progress, int offset, int count) throws DataAccessException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("bnnrThmSeq", bnnrThmSeq);
		params.put("progress", progress);
		params.put("offset", offset);
		params.put("count", count);
		
		return getSqlMapClientTemplate().queryForList(PREFIX + "selectBannerList", params);
	}

	public int selectBannerListCount(int bnnrThmSeq, String progress) throws DataAccessException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("bnnrThmSeq", bnnrThmSeq);
		params.put("progress", progress);
		
		return (Integer) getSqlMapClientTemplate().queryForObject(PREFIX + "selectBannerListCount", params);
	}

	@SuppressWarnings("unchecked")
	public List<DataMap> selectThemaBannerList() throws DataAccessException {
		return getSqlMapClientTemplate().queryForList(PREFIX + "selectThemaBannerList");
	}

}
